// .txt

beginzonescript;

variables;

short crime_tolerance = 5;
short last_abil;
short i;

body;

beginstate INIT_STATE;

	set_name(24,"Barragan");
	set_name(25,"Sergeant Jess");
	set_name(26,"Glenny");

//	add_range_to_group(first,last,whichg);

	if (gf(100,11) > 0) {
		print_str_color("Word of your infamy has gotten here before you. You are forever marked",3);
		print_str_color("  as a foe of the Shapers.",3);
		sf(35,1,1);
		}
	if (get_sdf(35,1) > 0) {
		make_zone_hostile();
		}
		else {
			print_str_color("This is a friendly fort. You are able to rest.",2);
			revive_party();
			}	
			
	sf(35,13,0);
	
	set_courage(34,0);
	set_courage(35,0);
	set_courage(36,0);
	
	last_abil = get_current_tick();
	
	set_crime_tolerance(crime_tolerance);
	break;

beginstate EXIT_STATE;

break;

beginstate START_STATE;
	if (gf(36,1) > 0)
		sf(35,18,1);
		
	// clear zone?
	if ((zone_clear(ME) == FALSE) && (get_flag(36,1) > 0)) {
		clear_zone(ME);	
		}
		
	if ((get_crime_level() >= crime_tolerance) && (get_sdf(35,1) == 0)) {
		make_zone_hostile();
		set_flag(35,1,1);
		}

	 if (gf(35,1) == 0) {
	 	if (gf(35,19) == 0) {
			if (get_ran(1,0,100) < 10)
				give_char_text_bubble(8,"Why are you here?");
			if (get_ran(1,0,100) < 10)
				give_char_text_bubble(8,"What is it, creature?");
			if (get_ran(1,0,100) < 10)
				give_char_text_bubble(8,"Somini, make a note.");
			}
	 	if (gf(35,19) > 0) {
			if (get_ran(1,0,100) < 10)
				give_char_text_bubble(8,"Try the Stoneworks.");
			if (get_ran(1,0,100) < 10)
				give_char_text_bubble(8,"I will search here.");
			if (get_ran(1,0,100) < 10)
				give_char_text_bubble(8,"Where is Somini?");
			if (get_ran(1,0,100) < 10)
				give_char_text_bubble(8,"Find the assassin!");
			}
	 	if ((gf(35,8) == 0) && (gf(36,1) == 0)) {
			if (get_ran(1,0,100) < 10)
				give_char_text_bubble(23,"Skritch.");
			if (get_ran(1,0,100) < 10)
				give_char_text_bubble(23,"Skritch. Skritch.");
			if (get_ran(1,0,100) < 10)
				give_char_text_bubble(23,"Dip. Dip.");
			if (get_ran(1,0,100) < 10)
				give_char_text_bubble(23,"Erase. Erase.");
			}
	 	if (gf(35,8) > 0) {
			if (get_ran(1,0,100) < 10)
				give_char_text_bubble(23,"Oh, dear.");
			if (get_ran(1,0,100) < 10)
				give_char_text_bubble(23,"...");
			if (get_ran(1,0,100) < 10)
				give_char_text_bubble(23,"Um.");
			}
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(24,"A customer!");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(24,"Things have been slow.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(24,"There's plenty in stock!");
	 	if (gf(35,19) == 0) {
			if (get_ran(1,0,100) < 10)
				give_char_text_bubble(25,"This place is Barred.");
			if (get_ran(1,0,100) < 10)
				give_char_text_bubble(25,"Turn back.");
			}
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(26,"Nice weather.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(26,"Care for some tea?");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(26,"Nice to have company.");
		}
	
	//if (((is_combat()) && (tick_difference(last_abil,get_current_tick()) > 0)) || ((is_group()) && (tick_difference(last_abil,get_current_tick()) > 5))) {
	//	last_abil = get_current_tick();
	//	}
break;

beginstate 10;
	sf(35,11,1);
break;

//	print_str("");
//	set_terrain_string_range(".",3);
//	set_terrain_string_range("The sign says - .",3);
